/**
 *	2.写一个程序从标准输入中读取c源程序并且确定花括号是否正确的配对，
 *	提示：你不用担心括号出现在注释中，字符串中或者字符常量中
**/

#include <stdio.h>

int main(void)
{
	int ch;
	int count = 0;

	while((ch = getchar()) != EOF)
	{
		if(ch == '{')
			count++;
		else if(ch == '}')
		{
			count--;
			if(count < 0)
				break;
		}
	}
	
	if(count < 0)
    	   	printf("the right brace appears before the left brace or right brace more than left brace!\n");
    	else if(count > 0)
   	     	printf("the left brace more than brace\n");
   	else
       		printf("paired ok!\n");

	return 0;
}
